package pe.com.certicom.moviles.model.dao;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.stereotype.Repository;

import com.ibatis.sqlmap.client.SqlMapClient;

import pe.com.certicom.moviles.model.beans.Carga;
import pe.com.certicom.moviles.model.beans.CargaExample;

@Repository
public class CargaDAOImpl extends SqlMapClientDaoSupport implements CargaDAO {

    /**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table carga
	 * @ibatorgenerated  Sun May 26 20:13:54 COT 2013
	 */
	public CargaDAOImpl() {
		super();
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table carga
	 * @ibatorgenerated  Sun May 26 20:13:54 COT 2013
	 */
	public int countByExample(CargaExample example) {
		Integer count = (Integer) getSqlMapClientTemplate().queryForObject(
				"carga.ibatorgenerated_countByExample", example);
		return count;
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table carga
	 * @ibatorgenerated  Sun May 26 20:13:54 COT 2013
	 */
	public int deleteByExample(CargaExample example) {
		int rows = getSqlMapClientTemplate().delete(
				"carga.ibatorgenerated_deleteByExample", example);
		return rows;
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table carga
	 * @ibatorgenerated  Sun May 26 20:13:54 COT 2013
	 */
	public int deleteByPrimaryKey(Long idCarga) {
		Carga key = new Carga();
		key.setIdCarga(idCarga);
		int rows = getSqlMapClientTemplate().delete(
				"carga.ibatorgenerated_deleteByPrimaryKey", key);
		return rows;
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table carga
	 * @ibatorgenerated  Sun May 26 20:13:54 COT 2013
	 */
	public void insert(Carga record) {
		getSqlMapClientTemplate()
				.insert("carga.ibatorgenerated_insert", record);
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table carga
	 * @ibatorgenerated  Sun May 26 20:13:54 COT 2013
	 */
	public void insertSelective(Carga record) {
		getSqlMapClientTemplate().insert(
				"carga.ibatorgenerated_insertSelective", record);
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table carga
	 * @ibatorgenerated  Sun May 26 20:13:54 COT 2013
	 */
	@SuppressWarnings("unchecked")
	public List<Carga> selectByExample(CargaExample example) {
		List<Carga> list = getSqlMapClientTemplate().queryForList(
				"carga.ibatorgenerated_selectByExample", example);
		return list;
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table carga
	 * @ibatorgenerated  Sun May 26 20:13:54 COT 2013
	 */
	public Carga selectByPrimaryKey(Long idCarga) {
		Carga key = new Carga();
		key.setIdCarga(idCarga);
		Carga record = (Carga) getSqlMapClientTemplate().queryForObject(
				"carga.ibatorgenerated_selectByPrimaryKey", key);
		return record;
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table carga
	 * @ibatorgenerated  Sun May 26 20:13:54 COT 2013
	 */
	public int updateByExampleSelective(Carga record, CargaExample example) {
		UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
		int rows = getSqlMapClientTemplate().update(
				"carga.ibatorgenerated_updateByExampleSelective", parms);
		return rows;
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table carga
	 * @ibatorgenerated  Sun May 26 20:13:54 COT 2013
	 */
	public int updateByExample(Carga record, CargaExample example) {
		UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
		int rows = getSqlMapClientTemplate().update(
				"carga.ibatorgenerated_updateByExample", parms);
		return rows;
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table carga
	 * @ibatorgenerated  Sun May 26 20:13:54 COT 2013
	 */
	public int updateByPrimaryKeySelective(Carga record) {
		int rows = getSqlMapClientTemplate().update(
				"carga.ibatorgenerated_updateByPrimaryKeySelective", record);
		return rows;
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table carga
	 * @ibatorgenerated  Sun May 26 20:13:54 COT 2013
	 */
	public int updateByPrimaryKey(Carga record) {
		int rows = getSqlMapClientTemplate().update(
				"carga.ibatorgenerated_updateByPrimaryKey", record);
		return rows;
	}

	/**
	 * This class was generated by Apache iBATIS ibator. This class corresponds to the database table carga
	 * @ibatorgenerated  Sun May 26 20:13:54 COT 2013
	 */
	private static class UpdateByExampleParms extends CargaExample {
		private Object record;

		public UpdateByExampleParms(Object record, CargaExample example) {
			super(example);
			this.record = record;
		}

		public Object getRecord() {
			return record;
		}
	}

	@Autowired
	public void createSqlMapClient(SqlMapClient sqlMapClient){
	   setSqlMapClient(sqlMapClient);
	}
}